Class Cell

Summary

Fully Qualified Name: CodeIgniter\View\Cell

Description

Class Cell

A simple class that can call any other class that can be loaded, and echo out it's result. Intended for displaying small blocks of content within views that can be managed by other libraries and not require they are loaded within controller.

Used with the helper function, it's use will look like:

    viewCell('\Some\Class::method', 'limit=5 sort=asc', 60, 'cache-name');

Parameters are matched up with the callback method's arguments of the same name:

    class Class {
        function method($limit, $sort)
    }

Alternatively, the params will be passed into the callback method as a simple array if matching params are not found.

    class Class {
        function method(array $params=null)
    }

Methods

Name Description Defined By
__construct() Cell constructor. Cell
prepareParams() Parses the params attribute. If an array, returns untouched. Cell
render() Render a cell, returning its body as a string. Cell

Method Details

__construct()

Cell constructor.

Parameter Name Type Description
$cache \CodeIgniter\Cache\CacheInterface

Returns:

prepareParams()

Parses the params attribute. If an array, returns untouched.

If a string, it should be in the format "key1=value key2=value". It will be split and returned as an array.

Parameter Name Type Description
$params
$params

Returns: array|null

render()

Render a cell, returning its body as a string.

Parameter Name Type Description
$library string
$params null
$ttl int
$cacheName string|null

Returns: string

Top